package com.magnusart.scrumppm.gui;

import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text;

import static com.magnusart.scrumppm.presenters.AbstractPresenter.WidgetTypes;

public class ProjectCreateNew extends Composite
{

	private Label headingLabel = null;
	private Label projectNameLabel = null;
	private Text projectNameText = null;
	private Label projectDetailsLabel = null;
	private Text projectDetailsTextArea = null;
	private Button createProjectButton = null;
	
	public ProjectCreateNew( Composite parent ) {
		super( parent, SWT.None );
		initialize();
	}

	private void initialize() {
		setLayout( new GridLayout( 2, false ) );
		
		GridData data = new GridData( GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_CENTER | GridData.GRAB_HORIZONTAL ) ;
		data.horizontalSpan = 2;
		
		headingLabel = new Label(this, SWT.NONE);
		headingLabel.setText("Create new project");
		headingLabel.setFont( FontFormatter.getBoldFont() );
		headingLabel.setLayoutData( data );
		
		projectNameLabel = new Label(this, SWT.NONE);
		projectNameLabel.setText("Project name");
		projectNameText = new Text(this, SWT.BORDER | SWT.FILL );
		projectNameText.setLayoutData( new GridData( GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL  ) );
		projectDetailsLabel = new Label( this, SWT.NONE );
		projectDetailsLabel.setText( "Project description" );
		projectDetailsLabel.setLayoutData( data );
		data = new GridData( GridData.FILL_BOTH );
		data.horizontalSpan = 2;
		
		projectDetailsTextArea = new Text( this, SWT.BORDER | SWT.MULTI | SWT.V_SCROLL );
		projectDetailsTextArea.setLayoutData( data );
		
		data = new GridData( GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_END );
		data.horizontalSpan = 2;
		
		createProjectButton = new Button( this, SWT.PUSH );
		createProjectButton.setText("Create project");
		createProjectButton.setLayoutData( data );
		createProjectButton.setData( WidgetTypes.CreateNewButton );
	}

	public Text getProjectNameText() {
		return projectNameText;
	}

	public Text getProjectDetailsTextArea() {
		return projectDetailsTextArea;
	}

	public Button getCreateProjectButton() {
		return createProjectButton;
	}

}  //  @jve:decl-index=0:visual-constraint="165,78"
